package org.usmile.algorithms.huawei.acm;

import java.util.Scanner;

// https://blog.csdn.net/qq_34465338/article/details/128330965
public class _不含101的数 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();

        int res = r - l + 1;
        for (int i = l; i <= r; i++) {
            String binary = Integer.toBinaryString(i);
            if (binary.contains("101")) {
                res--;
            }
        }

        System.out.println(res);
    }

}
